<include file="public:top" />
<!--编辑菜单-->
<form class="layui-form layui-form-pane" action="" style="padding:20px;">
	<input type="hidden" name="uid" value="{$info.uid}" />
  <div class="layui-form-item">
    <label class="layui-form-label">用户名</label>
    <div class="layui-input-block">
       <input type="text" class="layui-input" value="{$info.uid|getusername} - 用户名不能修改" disabled="disabled">
    </div>
  </div>
 
  <div class="layui-form-item">
    <label class="layui-form-label">出生日期</label>
    <div class="layui-input-block">
      <input type="text" name="date" name="birthday" id="birthday" lay-verify="date" placeholder="年-月-日" autocomplete="off" class="layui-input" value="{$info.byear}-{$info.bmonth}-{$info.bday}">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">所在地区</label>
    <div class="layui-input-block">
      
    </div>
  </div>
   
   <div class="layui-form-item">
    <label class="layui-form-label">用户性别</label>
    <div class="layui-input-block">
       <select name="gender" id="gender">
			<option <if condition="$info['gender'] eq 1">selected</if> value="1">男</option>
			<option <if condition="$info['gender'] eq 2">selected</if> value="2">保密</option>
			<option <if condition="$info['gender'] eq 3">selected</if> value="0">女</option>
		</select>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">个人标签</label>
    <div class="layui-input-block">
       <input type="text" class="layui-input" name="tags" id="tags" value="{$info.tags}">
       <div>个人标签必须用半角逗号,隔开才可以识别每个标签</div>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">联系QQ</label>
    <div class="layui-input-block">
       <input type="number" class="layui-input" name="contact" id="contact" value="{$info.contact}">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">个人签名</label>
    <div class="layui-input-block">
       <textarea name="intro" id="intro" class="layui-textarea" placeholder="请输入个人签名">{$info.intro}</textarea>
    </div>
  </div>
   
  <div class="layui-form-item">
        <label class=""></label>
        <div class="layui-input-block">
        <button class="layui-btn" lay-submit="" lay-filter="upbtn">提交保存</button>

        </div>
    </div>
</form>

<script type="text/javascript" src="__PUBLIC__/admin/layui/layui.js"></script>
<script>
layui.use(['layer','jquery','form','element','laydate'], function () {
   // 操作对象
    var layer = layui.layer,$ = layui.jquery,form = layui.form, element = layui.element ,laydate = layui.laydate;
  	  
  	//日期
  laydate.render({
    elem: '#birthday'
  });
   

    // 提交
    form.on('submit(upbtn)', function (data) {
    	var emailvalue = $("#email").val();
    	//验证邮箱是否存在
    	$.post("{:U('user/ajax_check_email')}",{email:emailvalue},function(res){
            if(res.status ==  0){
                layer.msg(res.msg,{time:1800},function(){
                	return false;
                });
            }else{
                // 提交添加
		        $.post("{:U('userinfo/edit')}",data.field,function(res){
		            if(res.status ==  1){
		                layer.msg(res.msg,{time:1800},function(){
		                    //关闭弹层后刷新父页面
		                    window.parent.location.reload();
		                    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
		                    parent.layer.close(index); 
		                });
		            }else{
		                layer.msg(res.msg,{time:1800},function(){
		                    return false;
		                });
		            }
		        });
		        return false;
		        // 添加END
            }
        });
        return false;
    });
});
</script>